package com.yzs.controller.admin;

import com.yzs.common.bean.R;
import com.yzs.entity.Notice;
import com.yzs.service.INoticeService;
import com.yzs.service.Impl.NoticeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    INoticeService ns = new NoticeServiceImpl();

    @RequestMapping("/getNoticeByPage")
    public R getHouseByPage(@RequestParam Integer currentPage, @RequestParam Integer pageSize){
        return ns.getNoticeByPage(currentPage,pageSize);
    }

    @RequestMapping("/addNotice")
    public R addNotice(@RequestBody Notice notice,@RequestParam String token){
        return ns.addNotice(notice,token);
    }

    @RequestMapping("/updateNotice")
    public R updateNotice(@RequestBody Notice notice){
        return ns.updateNotice(notice);
    }

    @RequestMapping("/deleteNotice")
    public R deleteNotice(@RequestParam Integer id){return ns.deleteNotice(id);}
}
